﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdUnitsFormatter : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdUnitsFormatter(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdUnitsFormatter_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdUnitsFormatter obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdUnitsFormatter()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdUnitsFormatter(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdUnitsFormatter cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdUnitsFormatter_cast(OdRxObject.getCPtr(pObj));
			OdUnitsFormatter result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdUnitsFormatter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdUnitsFormatter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdUnitsFormatter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdUnitsFormatter_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdUnitsFormatter_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdUnitsFormatter_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdUnitsFormatter createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdUnitsFormatter_createObject();
			OdUnitsFormatter result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdUnitsFormatter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdUnitsFormatter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdUnitsFormatter)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string formatCmColor(OdCmColorBase value)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatCmColor(this.swigCPtr, OdCmColorBase.getCPtr(value));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdCmColorBase unformatCmColor(string arg0)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr cPtr = GlobalsPINVOKE.OdUnitsFormatter_unformatCmColor(this.swigCPtr, arg0);
			OdCmColorBase result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdCmColorBase(cPtr, true));
				result = new OdCmColorBase(cPtr, false);
			}
			else
			{
				result = new OdCmColorBase(cPtr, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string formatLinear(double value)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatLinear(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double unformatLinear(string arg0)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatter_unformatLinear(this.swigCPtr, arg0);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string formatAngle(double value)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatAngle(this.swigCPtr, value);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double unformatAngle(string arg0)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatter_unformatAngle(this.swigCPtr, arg0);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static bool isZeroFeetSuppressed(int dimzin)
		{
			bool result = GlobalsPINVOKE.OdUnitsFormatter_isZeroFeetSuppressed(dimzin);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static bool isZeroInchesSuppressed(int dimzin)
		{
			bool result = GlobalsPINVOKE.OdUnitsFormatter_isZeroInchesSuppressed(dimzin);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string formatL(double value, OdUnitsFormatter.LUnits lUnits, int precision, int dimzin, int unitMode, string decsep, string thsep)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatL__SWIG_0(value, (int)lUnits, precision, dimzin, unitMode, decsep, thsep);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string formatL(double value, OdUnitsFormatter.LUnits lUnits, int precision, int dimzin, int unitMode, string decsep)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatL__SWIG_1(value, (int)lUnits, precision, dimzin, unitMode, decsep);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string formatL(double value, OdUnitsFormatter.LUnits lUnits, int precision, int dimzin, int unitMode)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatL__SWIG_2(value, (int)lUnits, precision, dimzin, unitMode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string formatArea(double value, OdUnitsFormatter.LUnits lUnits, int precision, int dimzin, int unitMode, string decsep, string thsep)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatArea__SWIG_0(value, (int)lUnits, precision, dimzin, unitMode, decsep, thsep);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string formatArea(double value, OdUnitsFormatter.LUnits lUnits, int precision, int dimzin, int unitMode, string decsep)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatArea__SWIG_1(value, (int)lUnits, precision, dimzin, unitMode, decsep);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string formatArea(double value, OdUnitsFormatter.LUnits lUnits, int precision, int dimzin, int unitMode)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatArea__SWIG_2(value, (int)lUnits, precision, dimzin, unitMode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double unformatL(string arg0)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatter_unformatL(arg0);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string formatA(double value, OdUnitsFormatter.AUnits aUnits, int precision, int dimzin, int unitMode, string decsep)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatA__SWIG_0(value, (int)aUnits, precision, dimzin, unitMode, decsep);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static string formatA(double value, OdUnitsFormatter.AUnits aUnits, int precision, int dimzin, int unitMode)
		{
			string result = GlobalsPINVOKE.OdUnitsFormatter_formatA__SWIG_1(value, (int)aUnits, precision, dimzin, unitMode);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double unformatA(string arg0)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatter_unformatA(arg0);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double unformatA_unnorm(string arg0, bool refuseDots)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatter_unformatA_unnorm__SWIG_0(arg0, refuseDots);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double unformatA_unnorm(string arg0)
		{
			double result = GlobalsPINVOKE.OdUnitsFormatter_unformatA_unnorm__SWIG_1(arg0);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public enum LUnits
		{
			kScientific = 1,
			kDecimal,
			kEngineering,
			kArchitectural,
			kFractional,
			kWindowsDesktop
		}

		public enum DimzinValues
		{
			kSuppressesZeroFeetAndPreciselyZeroInches,
			kIncludesZeroFeetAndPreciselyZeroInches,
			kIncludesZeroFeetAndSuppressesZeroInches,
			kIncludesZeroInchesAndSuppressesZeroFeet,
			kSuppressesLeadingZeros,
			kSuppressesTrailingZeros = 8,
			kSuppressesBothLeadingAndTrailingZeros = 12
		}

		public enum AUnits
		{
			kDegrees,
			kDegMinSec,
			kGrads,
			kRadians,
			kSurveyors
		}
	}
}
